package org.card.sqlparser;

/**
 * Created by card on 16/3/2.
 */
public class SqlColumn {

    private String javaName;

    private String name;

    private String javaType;

    private String type;

    public SqlColumn(String name, String type) {
        this.name = name;
        this.type = type;

        this.javaName = CreateSqlParser.underlineToCamel(name);
        if("int".equalsIgnoreCase(type)) {
            this.javaType = "Integer";
        }

        if("tinyint".equalsIgnoreCase(type)) {
            this.javaType = "Integer";
        }

        if("integer".equalsIgnoreCase(type)) {
            this.javaType = "Integer";
        }

        if("short".equalsIgnoreCase(type)) {
            this.javaType = "Integer";
        }

        if("varchar".equalsIgnoreCase(type)) {
            this.javaType = "String";
        }

        if("char".equalsIgnoreCase(type)) {
            this.javaType = "String";
        }

        if("datetime".equalsIgnoreCase(type)) {
            this.javaType = "Date";
        }
    }

    public String getJavaName() {
        return javaName;
    }

    public void setJavaName(String javaName) {
        this.javaName = javaName;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getJavaType() {
        return javaType;
    }

    public void setJavaType(String javaType) {
        this.javaType = javaType;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }
}
